#!/usr/bin/env coffee

pe = new (require('pretty-error'))()
app = require('../src/_app')

app.on(
    'error'
    (err, ctx) =>
        console.error pe.render(err)
        console.trace err
)

run = (port)->
    console.log "http://127.0.0.1:"+port
    app.listen(port)

run(
    (process.argv.pop() - 0) or require('./config').PORT
)
